﻿using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Aribaccio.Core
{
    /// <summary>
    /// 内置IOC容器管理接口
    /// </summary>
    public interface IContainerManager
    {
        /// <summary>
        /// 基础路径
        /// </summary>
        string BasePath { get; set; }
        /// <summary>
        /// 基础路径下配置文件
        /// </summary>
        string ConfigFileJson { get; set; }
        /// <summary>
        /// 容器服务配置对象
        /// </summary>
        IConfiguration Configuration { get; set; }
        /// <summary>
        /// 容器服务配置构造对象
        /// </summary>
        IConfigurationBuilder ConfigurationBuilder { get; set; }
        /// <summary>
        /// 容器服务构造对象
        /// </summary>
        IServiceProvider ServiceProvider { get; set; }
        /// <summary>
        /// 容器服务注册对象
        /// </summary>
        IServiceCollection ServiceCollection { get; set; }

        /// <summary>
        /// 构建容器配置
        /// </summary>
        void BuildConfig(string argConfigFileJson);
        /// <summary>
        /// 构建容器服务
        /// </summary>
        void BuildService();
        /// <summary>
        /// 获取构建的服务对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        T? GetContainerService<T>() where T : class;
        /// <summary>
        /// 获取构建的请求服务对象
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <returns></returns>
        T? GetContainerServiceRequired<T>() where T : class;
    }
}
